﻿using System;

[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", ConfigFileExtension = "config", Watch = true)]
namespace UpLoadPSDataSystem
{
    public class LogHelper
    {
        public static bool IsDebugEnabled()
        {
            return log4net.LogManager.GetLogger(typeof(LogHelper)).IsDebugEnabled;
        }
        /// <summary>
        /// 输出错误日志到Log4Net
        /// </summary>
        /// <param name="t"></param>
        /// <param name="ex"></param>       
        public static void Error(Type t, Exception ex)
        {
            var log = log4net.LogManager.GetLogger(t);
            log.Error("Error", ex);
            //UIRefreshProxy.RefreshUIError(DateTime.Now + "\r\n" + ex);
        }
        /// <summary>
        /// 输出错误日志到Log4Net
        /// </summary>
        /// <param name="t"></param>
        /// <param name="msg"></param>      
        public static void Error(Type t, string msg)
        {
            var log = log4net.LogManager.GetLogger(t);
            log.Error(msg);
           //UIRefreshProxy.RefreshUIError(DateTime.Now+"\r\n"+msg);
        }
        /// <summary>
        /// 输出信息日志到Log4Net
        /// </summary>
        /// <param name="t"></param>
        /// <param name="msg"></param>      
        public static void Info(Type t, string msg)
        {
           
            var log = log4net.LogManager.GetLogger(t);
            log.Info(msg);
           
        }
        /// <summary>
        /// 输出调试日志到Log4Net
        /// </summary>
        /// <param name="t"></param>
        /// <param name="msg"></param>      
        public static void Debug(Type t, string msg)
        {
            var log = log4net.LogManager.GetLogger(t);
            log.Debug(msg);
        }
    }
}
